import '../app_configure.dart';

import 'device_data_base.dart';
import 'device_data_v20.dart';
import 'device_data_v21.dart';
import 'device_data_v30.dart';
import 'device_data_v40.dart';
import 'device_data_v60.dart';
import 'device_data_v70.dart';
import 'entity/devcie_entity.dart';

class DeviceDataContext {
  static DeviceDataContext _instance = DeviceDataContext._();
  static DeviceDataContext get instance => _instance;
  DeviceDataContext._() {}

  DevcieDataBase _currentDevcie = DeviceDataV30();

  void switchDevice(DeviceType type) {
    //print('switchDevice  type =  $type');
    switch (type) {
      case DeviceType.Serial2_0:
        _currentDevcie = DeviceDataV20();
        break;
      case DeviceType.Serial2_1:
        _currentDevcie = DeviceDataV21();
        break;
      case DeviceType.Serial3_0:
        _currentDevcie = DeviceDataV30();
        break;
      case DeviceType.Serial4_0:
        _currentDevcie = DeviceDataV40();
        break;
      case DeviceType.Serial6_0:
        _currentDevcie = DeviceDataV60();
        break;
      case DeviceType.Serial7_0:
        _currentDevcie = DeviceDataV70();
        break;
      default:
        _currentDevcie = DeviceDataV30();
        break;
    }
    AppConfig.instance.deviceType = type;
    AppConfig.instance.bluetoothStatus = 0;
  }

  DevcieDataBase get devcie => _currentDevcie;

  // //停止
  // void actionStop() {}

  // //前进
  // void actionForward() {}

  // //后退
  // void actionBackward() {}

  // //左转
  // void actionLeft() {}

  // //右转
  // void actionRight() {}

  // //左转前进
  // void actionForwardLeft() {}

  // //右转前进
  // void actionForeardRight() {}

  // //左转后退
  // void actionBackwardLeft() {}

  // //右转后退
  // void actionBackwardRight() {}
}
